home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Libraries / tcl7.4b3 / doc / if.n < prev    next >
Encoding:
Text File  |  1994-12-17  |  1.6 KB  |  46 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" Copyright (c) 1994 Sun Microsystems, Inc.
  4. '\"
  5. '\" See the file "license.terms" for information on usage and redistribution
  6. '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  7. '\" 
  8. '\" @(#) if.n 1.2 94/12/17 16:18:08
  9. '\" 
  10. .so man.macros
  11. .HS if tcl
  12. .BS
  13. '\" Note:  do not modify the .SH NAME line immediately below!
  14. .SH NAME
  15. if \- Execute scripts conditionally
  16. .SH SYNOPSIS
  17. \fBif \fIexpr1 \fR?\fBthen\fR? \fIbody1 \fBelseif \fIexpr2 \fR?\fBthen\fR? \fIbody2\fR \fBelseif\fR ... \fR?\fBelse\fR? ?\fIbodyN\fR?
  18. .BE
  19.  
  20. .SH DESCRIPTION
  21. .PP
  22. The \fIif\fR command evaluates \fIexpr1\fR as an expression (in the
  23. same way that \fBexpr\fR evaluates its argument).  The value of the
  24. expression must be a boolean
  25. .VS
  26. (a numeric value, where 0 is false and
  27. anything is true, or a string value such as \fBtrue\fR or \fByes\fR
  28. for true and \fBfalse\fR or \fBno\fR for false);
  29. .VE
  30. if it is true then \fIbody1\fR is executed by passing it to the
  31. Tcl interpreter.
  32. Otherwise \fIexpr2\fR is evaluated as an expression and if it is true
  33. then \fBbody2\fR is executed, and so on.
  34. If none of the expressions evaluates to true then \fIbodyN\fR is
  35. executed.
  36. The \fBthen\fR and \fBelse\fR arguments are optional
  37. ``noise words'' to make the command easier to read.
  38. There may be any number of \fBelseif\fR clauses, including zero.
  39. \fIBodyN\fR may also be omitted as long as \fBelse\fR is omitted too.
  40. The return value from the command is the result of the body script
  41. that was executed, or an empty string
  42. if none of the expressions was non-zero and there was no \fIbodyN\fR.
  43.  
  44. .SH KEYWORDS
  45. boolean, conditional, else, false, if, true
  46.